package com.fingard.dsp.bank.reqrespobj.balance.detail;

import com.fingard.FGBiz;
import com.fingard.dsp.bank.directbank.specialDeal.BankAreaHelper;
import com.fingard.xml.XElement;

import java.util.Arrays;
import java.util.HashSet;

public class Req7506Detail {
    //账号ID（民生银行全球现金池使用）alon Created 2019-12-05
    public String accountId;

    // 账号地区区域码
    public String actArea;

    // 币种
    public String actCur;

    // 银行账号
    public String actNum;

    //账户名称
    public String actName;

    //上级账户
    public String higherLevelAct;

    //账户类型
    public String savingType;

    //外资银行新增字段
    //银行类型
    public String bankType;
    //为账户时区的当日日期
    public String zoneFrDate;
    //付款方IBAN
    public String payIBAN;
    //时区
    public String timeZone;
    //账户结构
    public String actBankType;
    //账户所在行的swiftcode
    public String swiftCode;

    //是否虚拟户标识 1-是，0-否
    public boolean isVirtual;
    //虚拟户编号
    public String virtualNo;
    //账户类型是否定期
    public boolean isDeposit;

    //直联账户权限
    public HashSet<String> directRight;

    public Req7506Detail(XElement p_xelement, String p_bankCode) throws Exception {
        actArea = p_xelement.getSingleTextNotNull("ActArea");
        if (FGBiz.dspCenter.convertBankArea) {
            BankAreaHelper bankAreaHelper = new BankAreaHelper(p_bankCode, actArea, "");
            bankAreaHelper.toBank();
            actArea = bankAreaHelper.bankAreaCode;
        }
        accountId = p_xelement.getSingleTextNotNull("AccountId");
        actCur = p_xelement.getSingleTextNotNull("ActCur");
        actNum = p_xelement.getSingleTextNotNull("ActNum");
        actName = p_xelement.getSingleTextNotNull("ActName");
        higherLevelAct = p_xelement.getSingleTextNotNull("HigherLevelAct");
        savingType = p_xelement.getSingleTextNotNull("SavingType");
        bankType = p_xelement.getSingleTextNotNull("BankType");
        zoneFrDate = p_xelement.getSingleTextNotNull("ZoneFrDate");
        payIBAN = p_xelement.getSingleTextNotNull("PayIBAN");
        timeZone = p_xelement.getSingleTextNotNull("TimeZone");
        actBankType = p_xelement.getSingleTextNotNull("ActBankType");
        swiftCode = p_xelement.getSingleTextNotNull("swiftcode");
        if ("1".equals(p_xelement.getSingleTextNotNull("IsVirtual"))) {
            isVirtual = true;
        } else {
            isVirtual = false;
        }
        if ("1".equals(p_xelement.getSingleTextNotNull("ISDeposit"))) {
            isDeposit = true;
        } else {
            isDeposit = false;
        }
        virtualNo = p_xelement.getSingleTextNotNull("VirtualNo");
        String[] directRights = p_xelement.getSingleTextNotNull("DirectRight").split(",");
        directRight = new HashSet<String>(Arrays.asList(directRights));
    }
    
    /*
    public void fromElement(Element p_element){
    	actArea = DomHelper.getSingleElementInnerText(p_element, "ActArea");
    	actCur = DomHelper.getSingleElementInnerText(p_element, "ActCur");
    	actNum = DomHelper.getSingleElementInnerText(p_element, "ActNum");
    }
    */
}
